-
Notifications
You must be signed in to change notification settings - Fork 25.2k
[Profiling] Add support for variable sampling frequency #128086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Profiling] Add support for variable sampling frequency #128086
Conversation
@@ -76,6 +76,10 @@ | |||
"type": "short", | |||
"index": false | |||
}, | |||
"Stacktrace.sampling_frequency": { | |||
"type": "long", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using long
here to
a) avoid hardly compressible FP type (no use case in sight for non-integer frequencies)
b) long
compresses as well as any other integer type (variable length encoding)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a second thought, in the real world the frequency values will be very low cardinality. So we might consider using an FP type to be prepared for future enhancements. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future we should switch to the same representation as OTel: period
and maybe if we want to allow more user-friendly queries a frequency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should switch to the same representation as OTel: period
To confirm, we talked about this in a separate zoom. As long as the period isn't defined by semantic conventions, we don't need to store it. Both, period
and frequency
can be transformed into each other on-the-fly and user expect to use frequency
in the KQL filtering UI.
.missing("") | ||
.field("Stacktrace.sampling_frequency") | ||
// missing(DEFAULT_SAMPLING_RATE) is used to include documents where the field is missing. | ||
.missing((long) DEFAULT_SAMPLING_FREQUENCY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows compatibility with old data that doesn't have the sampling_frequency
field.
Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments, LGTM
@@ -76,6 +76,10 @@ | |||
"type": "short", | |||
"index": false | |||
}, | |||
"Stacktrace.sampling_frequency": { | |||
"type": "long", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future we should switch to the same representation as OTel: period
and maybe if we want to allow more user-friendly queries a frequency.
x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/action/Resampler.java
Show resolved
Hide resolved
...ng/src/main/java/org/elasticsearch/xpack/profiling/action/TransportGetStackTracesAction.java
Outdated
Show resolved
Hide resolved
...ng/src/main/java/org/elasticsearch/xpack/profiling/action/TransportGetStackTracesAction.java
Show resolved
Hide resolved
...ng/src/main/java/org/elasticsearch/xpack/profiling/action/TransportGetStackTracesAction.java
Outdated
Show resolved
Hide resolved
...ng/src/main/java/org/elasticsearch/xpack/profiling/action/TransportGetStackTracesAction.java
Outdated
Show resolved
Hide resolved
...ng/src/main/java/org/elasticsearch/xpack/profiling/action/TransportGetStackTracesAction.java
Show resolved
Hide resolved
...ng/src/main/java/org/elasticsearch/xpack/profiling/action/TransportGetStackTracesAction.java
Show resolved
Hide resolved
…profiling/action/TransportGetStackTracesAction.java Co-authored-by: Christos Kalkanis <[email protected]>
This PR adds support for a variable sampling frequency.
So far, all trace events are assumed to be sampled at exactly 19 Hz (19 samples per second).
The profiling agent allows to configure this frequency as positive integer values - as allowed by the eBPF API. But due to limitations in our backend processing, which only support 19 Hz, we could not expose this option to customers. Once we support variable sampling frequencies in our backend and UI, we can open this configuration option to customers. A second use case could, in theory, be that we implement changing sampling frequency on-demand during runtime. "On-demand" could be increase accuracy during selected APM traces and spans.
In short, a sampling variable frequency allows reducing the storage costs significantly and/or allows increasing accuracy of profiling data.
TODO: